#include "../head.h"

int main(void)
{
    int epfd = epoll_create(1);
    
    epollAdd(epfd,STDIN_FILENO);
    
    struct epoll_event readySet[1];
    while(1)
    {
        printf("> ");
        fflush(stdout);
        int readyNum = epoll_wait(epfd,readySet,1,-1);
        printf("readySet[0].data.fd = %d\n",readySet[0].data.fd);

        if(readySet[0].data.fd == STDIN_FILENO)
        {
            char buf[1000] = {0};
            read(STDIN_FILENO,buf,sizeof(buf));
            printf("buf = %s\n",buf);
            //char* order = strtok(buf," ");
            //char* args = strtok(NULL," "); 
            //char* path1 = strtok(args,"/");
            //char* path2 = strtok(NULL,"/");
            //char* path3 = strtok(NULL,"/");

            //printf("order = %s\n",order);
            ////printf("args = %s\n",args);
            //printf("path1 = %s\n",path1);
            //printf("path2 = %s\n",path2);
            //printf("path3 = %s\n",path3);

            int orderflag;
            char args[256] = {0};
            whichOrder(buf,&orderflag,args);
            
            printf("orderflag = %d,args = %s\n",orderflag,args);
            
        }
    }
    return 0;
}

